<?php

function full_url()
{
	$s = empty($_SERVER["HTTPS"]) ? '' : ($_SERVER["HTTPS"] == "on") ? "s" : "";
	$protocol = substr(strtolower($_SERVER["SERVER_PROTOCOL"]), 0, strpos(strtolower($_SERVER["SERVER_PROTOCOL"]), "/")) . $s;
	$port = ($_SERVER["SERVER_PORT"] == "80") ? "" : (":".$_SERVER["SERVER_PORT"]);
	return $protocol . "://" . $_SERVER['SERVER_NAME'] . $port . $_SERVER['REQUEST_URI'];
}

function hostname() 
{
	$s = empty($_SERVER["HTTPS"]) ? '' : ($_SERVER["HTTPS"] == "on") ? "s" : "";
	$protocol = substr(strtolower($_SERVER["SERVER_PROTOCOL"]), 0, strpos(strtolower($_SERVER["SERVER_PROTOCOL"]), "/")) . $s;
	$port = ($_SERVER["SERVER_PORT"] == "80") ? "" : (":".$_SERVER["SERVER_PORT"]);
	return $protocol . "://" . $_SERVER['SERVER_NAME'] . $port;
}

function getBrowser()
{
	$u_agent = $_SERVER['HTTP_USER_AGENT'];
	$ub = '';
	if(preg_match('/MSIE/i',$u_agent))
	{
		$ub = "IE";
	}
	elseif(preg_match('/Firefox/i',$u_agent))
	{
		$ub = "Mozilla";
	}
	elseif(preg_match('/Safari/i',$u_agent))
	{
		$ub = "Safari";
	}
	elseif(preg_match('/Chrome/i',$u_agent))
	{
		$ub = "Chrome";
	}
	elseif(preg_match('/Opera/i',$u_agent))
	{
		$ub = "Opera";
	}
	return $ub;
}

$langfile = '../../lang/tokyo.xml';
// exit($langfile);
switch ($_SERVER['HTTP_HOST']){
	case "127.0.0.1:30000":
		$langfile ='../../lang/127.0.0.1.xml';
		break;
}
if (file_exists($langfile)) {
	$lang = simplexml_load_file($langfile);
} else {
	exit('please create a language file for this domain.');
}
?>